package cn.itsource.ymcc.web.controller;

import cn.itsource.ymcc.dto.LoginDto;
import cn.itsource.ymcc.result.JsonResult;
import cn.itsource.ymcc.service.ILogininfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping("/login")
public class LoginController {

    @Autowired
    private ILogininfoService logininfoService;

    /**
     * 统一认证接口：前后台通用
     * @param loginDto
     * @return
     */
    @PostMapping("/common")
    public JsonResult accountLogin(@RequestBody @Valid LoginDto loginDto){
        return logininfoService.accountLogin(loginDto);
    }

}
